package com.sadhoc.router.routing;

import java.util.Comparator;

public class RouteEntry implements Comparator<RouteEntry> {
	private String destinationIP;
	private String nextHop;
	private long metric;
	
	public RouteEntry(String destinationIP, String nextHop, long metric) {
		this.setDestinationIP(destinationIP);
		this.setNextHop(nextHop);
		this.setMetric(metric);
	}
	
	public RouteEntry() {
		
	}

	public String getDestinationIP() { return destinationIP; }
	public void setDestinationIP(String destinationIP) { this.destinationIP = destinationIP; }
	
	public String getNextHop() { return nextHop; }
	public void setNextHop(String nextHop) { this.nextHop = nextHop; }
	
	public long getMetric() { return metric; }
	public void setMetric(long metric) { this.metric = metric; }

	@Override
	public int compare(RouteEntry entry1, RouteEntry entry2) {
		String entryAddress1 = entry1.getDestinationIP();
		String entryAddress2 = entry2.getDestinationIP();
		
		return entryAddress1.compareTo(entryAddress2);
	}
	
	public RouteEntry clone() {
		return new RouteEntry(destinationIP, nextHop, metric);
	}
	
	
}